
<template>
  <div>
    <nav-bar>
      <div slot="left" class="backup" @click="backClick">
        <i ><</i>
      </div>
      <div slot="center" class="title">
        <div v-for="(item,index) in title"
             class="title-item"
             :class="{active:index===cindex}"
             @click="itemClick(index)">{{item}}
        </div>
      </div>
    </nav-bar>
  </div>
</template>

<script>
  import NavBar from "../../../components/common/navbar/NavBar";

  export default {
    name: "DetailNavBar",
    components: {NavBar},
    data() {
      return {
        title: ['商品', '参数', '评论', '推荐'],
        cindex: 0,
        isActive:false
      }
    },
    methods: {
      itemClick(index) {
        this.cindex = index;
        this.$emit('titleClick',index)
      },
      backClick() {
        this.$router.go(-1)
      },
    }
  }
</script>

<style scoped>
  .title {
    display: flex;

  }

  .title-item {
    flex: 1;
  }
  .active{
    color: #ff5777;
  }
  .backup{
    font-size: 22.5px;
    line-height: 44px;
    text-align: center;
  }
</style>